<template>
  <!-- 合同变更管理 -->
  <el-container>
    <el-header>
      <div class="left-panel">
        <!-- <el-button
          type="primary"
          icon="el-icon-plus"
          @click="add"
          v-auth-button="['add/vendor']"
        ></el-button> -->
      </div>
      <div class="right-panel">
        <div class="right-panel-search">
          <el-input
            v-model="searchValue.search"
            placeholder="变更名称"
            clearable
          ></el-input>
          <el-select
            v-model="searchValue.status"
            placeholder="请选择状态"
            style="width: 100%"
            clearable
          >
            <el-option label="待审核" :value="0" />
            <el-option label="已通过" :value="1" />
            <el-option label="未通过" :value="2" />
            <el-option label="审核中" :value="3" />
          </el-select>
          <el-button
            type="primary"
            icon="el-icon-search"
            @click="upsearch"
          ></el-button>
        </div>
      </div>
    </el-header>
    <el-main class="nopadding">
      <scTable
        ref="table"
        :apiObj="apiObj"
        row-key="id"
        stripe
        @row-dblclick="handleRowDblclick"
      >
        <el-table-column label="ID" prop="id" width="50"></el-table-column>
        <el-table-column
          label="合同编号"
          prop="num"
          width="250"
        ></el-table-column>
        <el-table-column
          label="变更名称"
          prop="name"
          min-width="200"
        ></el-table-column>
        <el-table-column
          label="变更版本"
          prop="changeVersion"
          width="250"
        ></el-table-column>
        <el-table-column
          label="变更理由"
          prop="changeReason"
          width="300"
        ></el-table-column>
        <el-table-column
          label="申请变更时间"
          prop="createTime"
          width="300"
        ></el-table-column>
        <el-table-column
          label="审核状态"
          prop="status"
          width="100"
          sortable
          fixed="right"
        >
          <template #default="scope">
            <p v-if="scope.row.status == 0">未审核</p>
            <p v-if="scope.row.status == 1" style="color: #67c23a">通过</p>
            <p v-if="scope.row.status == 2" style="color: #f56c6c">未通过</p>
            <p v-if="scope.row.status == 3" style="color: #ff9b31">审核中</p>
            <p v-if="scope.row.status == 4" style="color: #f56c6c">作废</p>
            <p v-if="scope.row.status == 5" style="color: #f56c6c">删除</p>
          </template>
        </el-table-column>
        <el-table-column label="操作" fixed="right" align="center" width="250">
          <template #default="scope">
            <el-button-group>
              <el-button
                text
                type="primary"
                size="small"
                @click="table_show(scope.row, scope.$index)"
                >查看</el-button
              >
            </el-button-group>
          </template>
        </el-table-column>
      </scTable>
    </el-main>
  </el-container>
</template>

<script>
export default {
  name: 'contractChange',
  data () {
    return {
      dialog: {
        save: false,
      },
      apiObj: this.$API.contract.contractChange.getContractChange,
      searchValue: {
        search: '',
        status: null
      }
    }
  },
  methods: {

    //查看
    table_show (row) {
      this.$router.push({
        path: '/contract/changeManagement/changeDetail',
        query: {
          id: row.id
        }
      })
    },

    //搜索
    upsearch () {
      this.$refs.table.upData(this.searchValue)
    },
    // 双击表格
    handleRowDblclick (row) {
      this.table_show(row)
    },

  }
}
</script>

<style>
</style>